// 获取年月日
function date(date) {
  var date = new Date(date)
    const year = date.getFullYear();
    let month = date.getMonth() + 1;
    if (month < 10) { month = '0' + month };
    let day = date.getDate();
    if (day < 10) { day = '0' + day };
    return year + '-' + month + '-' + day;
}
// 获取时分
function time(date) {
    let hour = date.getHours();
    if (hour < 10) { hour = '0' + hour };
    let minute = date.getMinutes();
    if (minute < 10) { minute = '0' + minute };
    return hour + ':' + minute;
}

module.exports = {
    date: date,
    time: time,
}